package com.power.sifa.approve.model.doc;

import cn.hutool.core.util.ObjectUtil;
import com.power.sifa.approve.model.enumeration.Tp_procmaterial;
import lombok.Data;
import org.springframework.stereotype.Component;

/**
 * @ClassName HearAuditHangupDoc
 * @Author xiongzw
 * @Date 2023/11/24 16:58
 * @Description 中止行政复议通知书
 * @Version: 1.0
 **/
@Data
public class HearAuditHangupDoc extends AbstractDoc {

    /**
     * 申请人
     */
    private String apl_admreview_applyname;
    /**
     * 正文
     */
    private String content;

    /**
     * 抄送
     */
    private String copyto;

    public HearAuditHangupDoc() {
        super();
        this.setDocType(Tp_procmaterial.HEAR_HANGUP);
    }

    public HearAuditHangupDoc(String applyid) {
        super(applyid);
        this.setDocType(Tp_procmaterial.HEAR_HANGUP);
    }

    public HearAuditHangupDoc(String applyid, String apl_admreview_applyname, String content, String copyto) {
        super(applyid);
        this.setDocType(Tp_procmaterial.HEAR_HANGUP);
        this.apl_admreview_applyname = apl_admreview_applyname;
        this.content = content;
        this.copyto = copyto;
    }

    private final static String TEMPLATE = "    {pronoun}对{apl_admreview_targetname}[{behavior}]不服提出的行政复议申请，本府依法已予受理。行政复议期间，（中止审理的事由）。根据《中华人民共和国行政复议法》第（xxx）条或者《中华人民共和国行政复议法实施条例》第四十一条第一款第（xxx）项的规定，现决定自{today}起中止该行政复议案件的审理。行政复议中止原因消除后，本府将恢复该行政复议案件的审理。";


    @Override
    public AbstractDoc generateTemplate(String applyid) {
        HearAuditHangupDoc template = new HearAuditHangupDoc(applyid);
        // 案号
        template.setApl_admre_audit_code(this.getApl_admre_audit_code());
        template.setApl_admreview_applyname(ObjectUtil.isNotNull(this.getAdmreObj()) ? this.getAdmreObj().getApplyname() : "");
        String content = TEMPLATE.replace("{apl_admreview_targetname}", ObjectUtil.isNotNull(this.getAdmreObj()) ?
                this.getAdmreObj().getTargetname() : "" );
        content = content.replace("{behavior}", this.transBehavior());
        content = content.replace("{pronoun}", this.transPronoun());
        content = content.replace("{today}", this.transModelToday(Boolean.FALSE));
        template.setContent(content);
        template.setCopyto("（其他当事人）");
        return template;
    }
}
